{% extends "base.html" %}
{% load i18n %}

{% block htmlhead %}
{{ block.super }}
<style type="text/css">
.boxed {
	border-style: solid;
	border-width: 2px;
   border-color: #6688AA;
	margin-top: 5px;
}

#results table {
	border-width: 1px;
	border-spacing: 2px;
	border-style: outset;
	border-color: gray;
	border-collapse: separate;
	background-color: white;
}
#results th {
	border-width: 1px;
	padding: 1px;
	border-style: dotted;
	border-color: black;
	background-color: white;
	-moz-border-radius: 0px 0px 0px 0px;
}
#results td {
	border-width: 1px;
	padding: 1px;
	border-style: dotted;
	border-color: black;
	background-color: white;
	-moz-border-radius: 0px 0px 0px 0px;
}

#mallet { width: 70%; margin-left: auto; margin-right: auto; background-color: white; }
#kfold { width: 70%; margin-left: auto; margin-right: auto; background-color: white; }
#features { width: 70%; margin-left: auto; margin-right: auto; background-color: white; }
#training { width: 70%; margin-left: auto; margin-right: auto; background-color: white; }
#testing { width: 70%; margin-left: auto; margin-right: auto; background-color: white; }
#results { width: 99%; margin-left: auto; margin-right: auto; background-color: white; font-size: .85em; }

</style>

<script language="javascript" type="text/javascript">
function submitkfold(){
document.kfoldform.k.value = document.kform.kin.value
document.kfoldform.submit();
}
</script>

{% endblock %}

{% block title %}HIDE: Analysis of {{ tag }}{% endblock %}

{% block content %}
<h1>Analysis of {{ tag }}</h1>

<form name="kform">
k = <input type="text" name="kin" value="{{ k }}"/>
</form>

<div id="mallet" class="boxed">
   <h2>Write mallet file to disk</h2>
   <form name="malletform" method="POST">
      {%csrf_token%}
      <input type="hidden" name="mallet"/>
	   <input type="hidden" name="k"/>
      <input type="Submit" value="Go"/>
   </form>
   {{mallet}}
</div>

<div id="kfold" class="boxed">
	<h2>Create k-fold cross validation sets</h2>
	<form name="kfoldform" method="POST">
	   {% csrf_token %}
	   <input type="hidden" name="kfold"/>
	   <input type="hidden" name="k" value={{ k }}/>
	   <input type="button" value="Go" onclick="submitkfold();"/>
	</form>
	{{ kfoldsets }}
</div>

<div id="features" class="boxed">
   <h2>Write feature files to disk</h2>
   <form name="featuresform" method="POST">
      {%csrf_token%}
      <input type="text" name="outdir" value="{{tag}}"/>
      <input type="checkbox" name="ftype" value="regex"/>Regex
      <input type="checkbox" name="ftype" value="affix"/>Affix
      <input type="checkbox" name="ftype" value="context"/>Context
      <input type="checkbox" name="ftype" value="dictionary"/>Dictionary
	   <input type="hidden" name="k" value={{ k }}/>
      <input type="hidden" name="features"/>
      <input type="Submit" value="Go"/>
   </form>
   {{features}}
</div>

<div id="sampling" class="boxed">
   <h2>Write sampled feature files to disk</h2>
   <form name="sampleform" method="POST">
      {%csrf_token%}
      Output Directory:<input type="text" name="outdir" value="{{tag}}-sample"/> <br/>
      Sample Probability:<input type="text" name="oprob"/> <br/>
      History Size:<input type="text" value="4" name="historysize"/> <br/>
	   <input type="hidden" name="k" value={{ k }}/>
      <input type="hidden" name="sample"/>
      <input type="Submit" value="Go"/>
   </form>
   {{features}}
</div>

<div id="training" class="boxed">
	<h2>Train CRF models for the k-folds</h2>
	<form name="trainform" method="POST">
	   {% csrf_token %}
	   <input type="hidden" name="k" value={{ k }}/>
	   <input type="hidden" name="train"/>
	   <input type="Submit" value="Go"/>
	</form>
	{{ trainsets }}
</div>
<div id="testing" class="boxed">
	<h2>Test k-folds against CRF models</h2>
	<form name="testform" method="POST">
	   {% csrf_token %}
	   <input type="hidden" name="k" value={{ k }}/>
	   <input type="hidden" name="test"/>
	   <input type="Submit" value="Go"/>
	</form>
	{{ testsets }}
</div>

<div id="results" class="boxed" style="overflow:auto">
	<h2>Results of k-folds</h2>
	<form name="resultsform" method="POST">
	   {% csrf_token %}
	   <input type="hidden" name="k" value={{ k }}/>
	   <input type="hidden" name="results"/>
	   <input type="Submit" value="Go"/>
	</form>
{% autoescape off %}
	{{ results }}
{% endautoescape %}
</div>

<div id="clear">
	<form name="clearform" method="POST">
	   {% csrf_token %}
	   <input type="hidden" name="k" value={{ k }}/>
	   <input type="hidden" name="clear"/>
	   <input type="Submit" value="Clear"/>
        </form>
</div>

{% endblock %}
